#include <iostream>
using namespace std;

int division(int a, int b)
{
	int i = 0;
	while(a > b * 1<<i)
		++i;
	int result = 0;
	for(int j = i-1; j>=0; j--)
	{
		if(a >= b * 1<<j)
		{
			result |= 0x01;
			a -= b * 1<<j;
		}
		result <<= 1;
	}
	return result>>1; 
}


int main()
{
	cout << "17/3=" << division(17, 3) << endl;
	cout << "1/3=" << division(1, 3) << endl;
	cout << "18/2=" << division(18, 2) << endl;
	return 0;
}
